import R from "@/common/type/response";
import { NextApiResponse } from "next";
import { SysMenuService } from "@/common/service/sys_menu";
import { AuthenticatedRequest, withAuth } from "@/common/middleware/auth";


export async function handler(req: AuthenticatedRequest, res: NextApiResponse) {
  try {
    const list = await SysMenuService.list();
    R.success(res, list);
  } catch (e: any) {
    R.error(res, e.message);
  }
}

export default withAuth(handler,{GET:'system:menu:list'}); 